﻿using System;
using System.Collections.Generic;
using System.Text;

namespace OnlineLearning.Common
{
    public static class RMBFormat
    {
        /*
          如1234567变成1,234,567
          方法：x.ToString("###,###")   或  1234567.ToString("N0")  
        */
        /// <summary>
        /// C#中用最简单的方法把数字（不含小数）转换为千分位格式
        /// </summary>
        /// <param name="rmb"></param>
        /// <returns></returns>
        public static string RMBToString(int rmb)
        {
            return rmb.ToString("N0");
        }
        /// <summary>
        /// C#中把数字转换成带两位小数的千分位字符,如1234567.891变成1,234,567.89
        /// </summary>
        /// <param name="rmb"></param>
        /// <returns></returns>
        public static string RMBFormatStr(decimal rmb)
        {
            return String.Format("{0:N}", rmb);
        }
    }
}
